/*
 * PublicThread.h
 *
 *  Created on: 2017-6-1
 *      Author: root
 */

#ifndef PUBLICTHREAD_H_
#define PUBLICTHREAD_H_
//隐藏pthread.h
#if __WIN32__
typedef unsigned int pthread_t;
#else
typedef unsigned long int pthread_t;
#endif
//强制使用文件
//pthread系列函数不应出现在其他位置
//公共锁
class PublicLock {
    void*m_Mutex;
public:
    PublicLock();
    ~PublicLock();
void Lock();
void UnLock();
};
//读写锁
class PublicRWLock {
    void*m_RwLock;
public:
    PublicRWLock();
    ~PublicRWLock();
void RdLock();
void WrLock();
void UnLock();
};
typedef void*(thrfunc)(void *arg);
int ThreadCreate(pthread_t*id,thrfunc*funfunc,void*args);
int ThreadDestroy(pthread_t id);
void ThreadBindCPU(pthread_t id,int cpuid);
#endif /* PUBLICTHREAD_H_ */
